import api from "./api";
import type Typings from "@/typings";

export default {
  menuAllTreeApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/api/menu/allTree";
    return api.get(url, data, { ...config });
  },

  menuTreeApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/api/menu/tree";
    return api.get(url, data, { ...config });
  },

  menuAddApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/api/menu/add";
    return api.post(url, data, { ...config, openLoading: true });
  },

  menuUpdateApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/api/menu/update";
    return api.post(url, data, { ...config, openLoading: true });
  },

  menuCheckApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/api/menu/check";
    return api.get(url, data, { ...config });
  },

  menuRemoveApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/api/menu/remove";
    return api.get(url, data, { ...config });
  },
};
